package mylibrary.classloader;

public class LoaderSample1 {

	public static void main(String[] args) {
		
		Class c;
		ClassLoader cl = ClassLoader.getSystemClassLoader();
		System.out.println(cl);
		
		while (cl != null) {
			cl = cl.getParent();
			System.out.println(cl);
		}
		
		try {
			c = Class.forName("java.lang.Object");
			cl = c.getClassLoader();
			System.out.println("java.lang.Object 's loader is " + cl);
			
			c = Class.forName("classloader.LoaderSample1");
			cl = c.getClassLoader();
			System.out.println("classloader.LoaderSample1 's loader is " + cl);
			
			
			LoaderSample1 sample = new LoaderSample1();
			sample.test();
			
			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	
	public void test() {
		System.out.println("1111111" + this.getClass().getClassLoader().toString());
		
		//System.out.println("2222222" + sun.security.mscapi.PRNG.class.getClassLoader());
	}
	
}
